package cn.stylefeng.guns.sys.modular.system.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.modular.system.entity.BtyPaymentOrder;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyPaymentOrderParam;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyPerformanceMonthInformationPageListParam;
import cn.stylefeng.guns.sys.modular.system.model.result.BtyPaymentOrderAndYybbResult;
import cn.stylefeng.guns.sys.modular.system.service.BtyPaymentOrderService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;


/**
 * 店面日营业现金支付详情表控制器
 *
 * @author wjk
 * @Date 2021-12-07 17:32:34
 */
@Controller
@RequestMapping("/btyPaymentOrder")
public class BtyPaymentOrderController extends BaseController {

    private String PREFIX = "/modular/system/btyPaymentOrder";

    @Autowired
    private BtyPaymentOrderService btyPaymentOrderService;

    /**
     * 跳转到主页面
     *
     * @author wjk
     * @Date 2021-12-07
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/btyPaymentOrder.html";
    }

    /**
     * 新增页面
     *
     * @author wjk
     * @Date 2021-12-07
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/btyPaymentOrder_add.html";
    }

    /**
     * 编辑页面
     *
     * @author wjk
     * @Date 2021-12-07
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/btyPaymentOrder_edit.html";
    }


    /**
     * 统计分析
     *
     * @author wjk
     * @Date 2021-12-07
     */
    @RequestMapping("/analysis")
    public String echarts() {
        return PREFIX + "/btyPaymentOrder_analysis.html";
    }

    /**
     * 新增接口
     *
     * @author wjk
     * @Date 2021-12-07
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(BtyPaymentOrderParam btyPaymentOrderParam) {
        this.btyPaymentOrderService.add(btyPaymentOrderParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author wjk
     * @Date 2021-12-07
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(BtyPaymentOrderParam btyPaymentOrderParam) {
        this.btyPaymentOrderService.update(btyPaymentOrderParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author wjk
     * @Date 2021-12-07
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(BtyPaymentOrderParam btyPaymentOrderParam) {
        this.btyPaymentOrderService.delete(btyPaymentOrderParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author wjk
     * @Date 2021-12-07
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(BtyPaymentOrderParam btyPaymentOrderParam) {
        BtyPaymentOrder detail = this.btyPaymentOrderService.getById(btyPaymentOrderParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author wjk
     * @Date 2021-12-07
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(BtyPaymentOrderParam btyPaymentOrderParam) {
        return this.btyPaymentOrderService.findPageBySpec(btyPaymentOrderParam);
    }

    /**
     * 每日营业现金收入和每日交账数据趋势
     * @author ws
     * @Date 2021-02-24
     */
    @ResponseBody
    @PostMapping("/getCashAndPay")
    public ResponseData  cashAndPay(BtyPaymentOrderParam param){

        //店内现金交账统计分析
        List<BtyPaymentOrderAndYybbResult> listCashAndPay = this.btyPaymentOrderService.cashAndPay(param);
        return ResponseData.success(listCashAndPay);
    }

    /**
     * 每日营业数据
     * @author ws
     * @Date 2021-02-24
     */
    @ResponseBody
    @PostMapping("/getYingYe")
    public ResponseData  yingYe(BtyPaymentOrderParam param){

        //店内现金交账统计分析
        List<BtyPaymentOrderAndYybbResult> listYingYe = this.btyPaymentOrderService.getYingYe(param);
        return ResponseData.success(listYingYe);
    }

    /**
     * 每日交账数据
     * @author ws
     * @Date 2021-02-24
     */
    @ResponseBody
    @PostMapping("/getPayAll")
    public ResponseData  payAll(BtyPaymentOrderParam param){

        //店内现金交账统计分析
        List<BtyPaymentOrderAndYybbResult> payAll = this.btyPaymentOrderService.getPayAll(param);
        return ResponseData.success(payAll);
    }

    /**
     * 每日交账数据
     * @author ws
     * @Date 2021-02-24
     */
    @ResponseBody
    @PostMapping("/getCash")
    public ResponseData  cash(BtyPaymentOrderParam param){

        //店内现金交账统计分析
        List<BtyPaymentOrderAndYybbResult> payAll = this.btyPaymentOrderService.getCash(param);
        return ResponseData.success(payAll);
    }
}


